import { _axios } from './request'
// 文章详情
function articlesInfo (id) {
  return _axios({
    url: 'v1_0/articles/' + id,
    needToken: true
  })
}
// 文章点赞
function articleLikings (data) {
  return _axios({
    url: 'v1_0/article/likings',
    method: 'post',
    data,
    needToken: true
  })
}
// 取消文章点赞
function articleLikingsTarget (id) {
  return _axios({
    url: 'v1_0/article/likings/' + id,
    method: 'DELETE',
    needToken: true
  })
}
// 对文章不喜欢
function articleDislikes (data) {
  return _axios({
    url: 'v1_0/article/dislikes',
    method: 'post',
    data,
    needToken: true
  })
}
// 取消对文章不喜欢
function articleDislikesTarget (id) {
  return _axios({
    url: 'v1_0/article/dislikes/' + id,
    method: 'DELETE',
    needToken: true
  })
}
// 关注用户
function userFollowings (data) {
  return _axios({
    url: 'v1_0/user/followings',
    method: 'post',
    data,
    needToken: true
  })
}
// 取消关注用户
function userFollowingsTarget (id) {
  return _axios({
    url: 'v1_0/user/followings/' + id,
    method: 'DELETE',
    needToken: true
  })
}
// 收藏文章
function articleCollections (data) {
  return _axios({
    url: 'v1_0/article/collections',
    method: 'post',
    data,
    needToken: true
  })
}
// 取消收藏文章
function articleCollectionsTarget (id) {
  return _axios({
    url: 'v1_0/article/collections/' + id,
    needToken: true,
    method: 'DELETE'
  })
}
// 获取评论
function commentsQuery (params) {
  return _axios({
    url: 'v1_0/comments',
    params
  })
}
// 发送评论
function commentsBody (data) {
  return _axios({
    url: 'v1_0/comments',
    method: 'post',
    data
  })
}
// 对评论点赞
function commentLikings (data) {
  return _axios({
    url: 'v1_0/comment/likings',
    method: 'post',
    data,
    needToken: true
  })
}
// 取消对评论点赞
function commentLikingsTarget (id) {
  return _axios({
    url: 'v1_0/comment/likings/' + id,
    method: 'DELETE',
    needToken: true
  })
}
export {
  articlesInfo,
  articleLikings,
  articleDislikes,
  articleLikingsTarget,
  articleDislikesTarget,
  userFollowings,
  userFollowingsTarget,
  articleCollections,
  articleCollectionsTarget,
  commentsQuery,
  commentsBody,
  commentLikings,
  commentLikingsTarget
}
